

************** This program generates the results in Table A5: voting for the incumbent government as outcome variable **************

clear all
set more off, permanently
cd "$localdir\Data"
global output "$localdir\Output"



***************************************************** VOTING FOR PARTY IN GOVERNMENT (INTENTION) ******************************************************

use "Voting RF for Analysis - Last Year.dta", clear

g vote_government=0
replace vote_government=1 if (year==2012 | year==2013) & (vote_intent==1 | vote_intent==2 | vote_intent==4)
replace vote_government=1 if (year==2010 | year==2011) & (vote_intent==3 | vote_intent==6)
tab year vote_government, row

keep if vote_government!=. & grossunemp_enter_network!=.

* Collapse
bysort unique year: egen grossunemp_enter_network_share=mean(grossunemp_enter_network)
drop *_network
duplicates drop unique year, force

tab year 

lab var grossunemp_enter_network_share "Unemployment shock (network share)"

* Results
display c(current_time)
reghdfe vote_government grossunemp_enter_network_share, absorb(both ind2_year ocp_year educ_year) cluster(muni)
sum vote_government if e(sample)==1
local mean_outcome=r(mean)
local sd_outcome=r(sd)
sum grossunemp_enter_network_share if e(sample)==1
local mean_shock=r(mean)
local sd_shock=r(sd)
outreg2 using "$output\TableA5.xls", replace nocons nor ctitle("Intend to vote for incumbent party") bdec(3) sdec(3) adec(3) label ///
adds(Outcome mean,`mean_outcome', Outcome sd,`sd_outcome', Unemployment shock mean,`mean_shock',  Unemployment shock sd,`sd_shock') 

display c(current_time)















